import com.google.common.collect.Maps;
import com.google.common.primitives.Ints;

import java.lang.reflect.Field;
import java.util.HashMap;

/**
 * @author wy
 * @date 2020/3/13 16:07
 */
public class Test {

  public static int f(int a){
    try {
      a++;
      return 1;
    }finally {
      a*=2;
      return 5;
    }
  }

  public static void main(String[] args) {
    /**
     * 上面的getxxxCache可优化
     * 出现问题返回值？？？
     *  CacheFactory o = (CacheFactory)field.get(CacheManager.class);
     *  这个类型应该强转为子类?怎么转啊
     * @return

    public static Cache getCache(Class<? extends CacheFactory> c) {
      String name = c.getSimpleName();
      String fiedName = name.substring(0, 1).toLowerCase()+name.substring(1);
      try {
        Field field = CacheManager.class.getDeclaredField(fiedName);
        if (field != null) {
          CacheFactory o = (CacheFactory)field.get(CacheManager.class);

          return o.getCache();
        }
      } catch (NoSuchFieldException e) {
        e.printStackTrace();

      } catch (IllegalAccessException e) {
        e.printStackTrace();
      }
      return null;
    }
     */
    System.out.println(Ints.MAX_POWER_OF_TWO);
  }
}
